/*
 * @Author: your name
 * @Date: 2021-12-17 15:26:00
 * @LastEditTime: 2022-04-29 16:40:27
 * @LastEditors: Please set LastEditors
 * @Description: 定义数据库的参数和数据类型
 * @FilePath: \blog-api\src\entities\user.entity.ts
 */

import { Column, Entity, PrimaryGeneratedColumn, BaseEntity } from 'typeorm';

@Entity('visit_log')
export class VisitLog extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({type:'varchar', name: 'visit_mode', comment: '访问方式'})
  visit_mode: string;

  @Column({type:'varchar', name: 'visit_browser', comment: '访问浏览器'})
  visit_browser: string;

  @Column({type:'varchar', name: 'visit_ip', comment: '访问IP'})
  visit_ip: string;

  @Column({type:'int', name: 'visit_num', comment: '访问次数'})
  visit_num: number;

  @Column({
    name: 'create_time',
    type: 'timestamp',
    comment: '创建时间',
    default: () => 'CURRENT_TIMESTAMP',
  })
  create_time: Date;

  @Column({
      name: 'update_time',
      type: 'timestamp',
      comment: '更新时间',
      default: () => 'CURRENT_TIMESTAMP',
      onUpdate: 'CURRENT_TIMESTAMP',
  })
  update_time: Date;
}